<me:UITXTKON x:Class="WPFExcelReport.TXT"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"   
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UITXTKON.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UITXTKON.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Grid.RowSpan="2"  
                   Text="{Binding INFO,Converter={StaticResource gb2312}}"
                   Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}"> 
        </TextBlock>
        <Grid Grid.Row="0"  Margin="10,0,0,0"  VerticalAlignment="Top" 
              Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                <Button.Background>
                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                </Button.Background>
            </Button>
            <ex:TXT72   Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" KeyUp="txt_KeyUp" MinLines="1"  
                      Text="{Binding TXTKTEXT,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}"
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" 
                     MaxLength="72" MaxLines="1" TextWrapping="Wrap" />
        </Grid>  
        <DataGrid Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"
            Grid.Row="1"   
                   VerticalAlignment="Top" 
                   IsReadOnly="True"
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HorizontalAlignment="Stretch"
                   HeadersVisibility="Column" 
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True"
                    x:Name="dlgMaster"
                   RowDetailsVisibilityMode="Visible" 
                   >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=TXTKPOS, Mode=TwoWay}"  Header="{Binding Source={Localization:Translate Word=行}}" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=TXTKTEXT,Converter={StaticResource ResourceKey=gb2312}, Mode=TwoWay}"  Header="{Binding Source={Localization:Translate Word=说明}}" Width="Auto"  MinWidth="200" />
                <DataGridTextColumn Binding="{Binding Path=TXTKATR, Mode=TwoWay}"  Header="{Binding Source={Localization:Translate Word=分类}}" Width="Auto" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</me:UITXTKON>
